package com.kingbar.app.chat.kingwesocket;

import com.kingbar.app.chat.kingwesocket.ws.SpringConfigurator;
import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.WebApplicationContext;

@SpringBootApplication
public class KingWeSocketApplication implements ApplicationContextAware {

    public static void main(String[] args) {
        SpringApplication.run(KingWeSocketApplication.class, args);
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        if (applicationContext instanceof WebApplicationContext) {
            SpringConfigurator.setApplicationContext((WebApplicationContext) applicationContext);
        }
    }
}
